package com.promise.paging

import android.arch.lifecycle.MutableLiveData
import android.arch.paging.DataSource
import java.util.concurrent.Executor

/**
 * Created by CQNNJ-003 on 2018/6/8.
 */
class UserDataSourceFactory(private val redditApi : Api,private val retryExecutor: Executor) : DataSource.Factory<String,QuestsData>() {

    val sourceLiveData = MutableLiveData<PageKeyedUserDataSource>()
    override fun create(): DataSource<String, QuestsData> {
        val source = PageKeyedUserDataSource(redditApi,retryExecutor)
        sourceLiveData.postValue(source)
        return source
    }
}